#include "cardpanel.h"
#include <QMouseEvent>
#include <QPainter>
CardPanel::CardPanel(QWidget *parent) : QWidget(parent)
{

}

void CardPanel::setImage(QPixmap &font, QPixmap &back)
{
    m_front = font;
    m_back = back;
    setFixedSize(m_front.size());
    update();
}

QPixmap CardPanel::getimage()
{
    return m_front;
}

void CardPanel::setFrontSize(bool flag)
{
    m_isfront = flag;
}

bool CardPanel::isFrontSide()
{
    return  m_isfront;
}

void CardPanel::setSeclected(bool flag)
{
   m_isSelect = flag;
}

bool CardPanel::isSelected()
{
    return m_isSelect;
}

void CardPanel::setCard(Card &card)
{
    m_card = card;
}

void CardPanel::setOwner(Player *player)
{
    m_owner = player;
}

Player *CardPanel::getOwner()
{
    return m_owner;
}

void CardPanel::paintEvent(QPaintEvent *event)
{
    QPainter p(this);
    if(m_isfront)
    {
        p.drawPixmap(rect(),m_front);
    } else {
        p.drawPixmap(rect(), m_back);
    }
}

void CardPanel::mousePressEvent(QMouseEvent *event)
{

}
